/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.shef.zeno.mywoz;

import edu.emory.mathcs.backport.java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

/**
 *
 * @author samf
 */
public class OptionsMap {
    HashMap<String, Boolean> optionsMap;
    public OptionsMap(Collection<String> options) {
        optionsMap = new HashMap<>();
       for (String key : options) { 
           optionsMap.put(key, true);
       }
    }
    public void disable(String[] options) {
        for (String option : options) {
            optionsMap.put(option, false);
        }
    }
    public void enable(String[] options) {
        for (String option : options) {
            optionsMap.put(option, true);
        }
    }
    public void disableAllExcept(String[] options) {
        List<String> list = Arrays.asList(options);
        for (String option : optionsMap.keySet()) {
            if (list.contains(option)) {
                optionsMap.put(option, true);
            }
            else {
                optionsMap.put(option, false);
            }
        }
    }

    Iterable<String> keySet() {
        return optionsMap.keySet();
    }

    boolean get(String key) {
        return optionsMap.get(key);
    }
    public void enableAll() {
        for (String option : optionsMap.keySet()) {
            optionsMap.put(option, true);
        }
    }
    
     public void disableAll() {
        for (String option : optionsMap.keySet()) {
            optionsMap.put(option, false);
        }
    }

        
}
